/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.ssau.datamanager;

import java.util.Collection;
import java.util.Date;
import javax.ejb.Remote;
import ru.ssau.entities.DataAccessException;
import ru.ssau.entities.Message;
import ru.ssau.entities.User;
import ru.ssau.entities.Thread;

@Remote
public interface DataManager {

    void addThread(String caption) throws DataAccessException;
    void addThread(Thread thread) throws DataAccessException;
    void replaceThread(Integer id, String caption) throws DataAccessException;
    void replaceThread(Thread thread) throws DataAccessException;
    Thread getThreadById(Integer id) throws DataAccessException;
    void deleteThreadById(Integer id) throws DataAccessException;
    Collection<Thread> getAllThreads() throws DataAccessException;
    Collection<Thread> findThreadsByCaption(String caption) throws DataAccessException;

    void addMessage(String caption, String text, Integer userId, Integer threadId, Date postDate) throws DataAccessException;
    void addMessage(Message message, Integer userId, Integer threadId) throws DataAccessException;
    void replaceMessage(Integer id, String caption, String text, Integer userId, Integer threadId, Date postDate) throws DataAccessException;
    void replaceMessage(Message message, Integer newUserId, Integer newThreadId) throws DataAccessException;
    Message getMessageById(Integer id) throws DataAccessException;
    void deleteMessageById(Integer id) throws DataAccessException;
    Collection<Message> getAllMessages() throws DataAccessException;
    Collection<Message> findMessagesByCaption(String caption) throws DataAccessException;

    void addUser(String name, Date regDate, String info, String login, String password) throws DataAccessException;
    void addUser(User user) throws DataAccessException;
    void replaceUser(User user) throws DataAccessException;
    void replaceUser(Integer id, String name, Date regDate, String info, String login, String password) throws DataAccessException;
    User getUserById(Integer id) throws DataAccessException;
    void deleteUserById(Integer id) throws DataAccessException;
    Collection<User> getAllUsers() throws DataAccessException;
    Collection<User> findUsersByName(String name) throws DataAccessException;

}
